import request from '@/utils/request'
// 目录列表
export function getDirectorys(params) {
  return request({
    url: '/directorys',
    params
  })
}

// 更改状态
export function changeState(data) {
  return request({
    url:`/directorys/${data.id}/${data.state}`,
    method:'POST',
    data:{
      id:data.id,
      state:data.state
    }
  })
}
// 新增目录
export function addDirectorys(data) {
  return request({
    url: '/directorys',
    method:'POST',
    data
  })
}
// 删除目录
export function delDirectorys(id) {
  return request({
    url: `/directorys/${id}`,
    method:'DELETE',
  })
}
// 编辑目录
export function editDirectorys(data) {
  return request({
    url: `/directorys/${data.id}`,
    method:'PUT',
    data
  })
}

// 目录详情，修改数据回显
export function getDirectorysDetail(id) {
  return request({
    url: `/directorys/${id}`,
  })
}

// 根据学科id展示数据详情
export function getDirectorysById(params) {
  return request({
    url: '/directorys',
    params
  })
}